@(project: String, task: String)

@widgets.dialog(title = "Add Reference Links", width = 500) {
  <table border="0">
    <tr>
      <td>Source</td>
      <td>
        <input name="source" title="Source" size="40"/>
      </td>
    </tr>
    <tr>
      <td>Target</td>
      <td>
        <input name="target" title="Target" size="40"/>
      </td>
    </tr>
    <tr>
      <td>Type</td>
      <td>
        <select name="linktype" title="Reference link type">
          <option value="positive">Positive</option>
          <option value="negative">Negative</option>
          <option value="unlabeled">Unlabeled</option>
        </select>
      </td>
    </tr>
  </table>

  <script>
  function submit() {
    var values = {
      source: $("input[name='source']").val(),
      target: $("input[name='target']").val(),
      type: $("select[name='linktype']").val()
    };

    $.ajax({
      type: 'PUT',
      url: '@config.baseUrl/linking/tasks/@project/@task/referenceLink?linkType=' + values.type + '&source=' + encodeURIComponent(values.source) + '&target=' + encodeURIComponent(values.target),
      data: values,
      success: function(data) {
        window.location.reload();
      },
      error: function(request) {
        alert(request.responseText);
      }
    });
  }
  </script>
}